home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / ae_14.zip / AE0.PAS < prev    next >
Pascal/Delphi Source File  |  1991-03-12  |  15KB  |  267 lines

  1. unit AE0 ;
  2.  
  3. {$B-}
  4. {$I-}
  5. {$S+}
  6. {$V-}
  7.  
  8. {-----------------------------------------------------------------------------}
  9. { This unit contains the definitions of all constants, types                  }
  10. { and global variables                                                        }
  11. {-----------------------------------------------------------------------------}
  12.  
  13. interface
  14.  
  15. uses Dos ;
  16.  
  17. const MaxNrOfWorkspaces = 3 ;     { maximum number of workspaces }
  18.       WsBufSize         = 65534 ; { maximum size of workspace buffer }
  19.       OnePercent        = 655 ;   { = 1% of WsBufSize. Used in status line }
  20.       PasteBufSize      = 16384 ; { maximum size of paste buffer }
  21.       MaxMacroLength    = 100 ;   { maximum number of keystrokes in a macro }
  22.       NrOfMacros        = 10 ;    { number of macros }
  23.       MacroStackDepth   = 10 ;    { maximum size of macro stack }
  24.       PosStackDepth     = 10 ;    { maximum size of position stack }
  25.       Inactive          = 0 ;     { generally used value }
  26.       NrOfCursorTypes   = 4 ;     { number of cursor available types }
  27.       UnderLineCursor   = 1 ;     { cursor type }
  28.       HalfBlockCursor   = 2 ;     { cursor type }
  29.       BlockCursor       = 3 ;     { cursor type }
  30.       NoBlinkCursor     = 4 ;     { cursor type }
  31.       NrOfColorSettings = 8 ;     { size of ScreenColorArray }
  32.       LinesOnScreen     = 25 ;    { number of lines on a screen }
  33.       NrOfTextLines     = 24 ;    { = LinesOnScreen - 1 }
  34.       ColsOnScreen      = 80 ;    { number of columns on a screen }
  35.       CharsOnScreen     = 2000 ;  { number of characters on a screen (25*80) }
  36.       BkspKey           = 264 ;   { keynumber of Backspace key }
  37.       TabKey            = 265 ;   { keynumber of Tab key }
  38.       CtrlReturnKey     = 266 ;   { keynumber of Control-Return key }
  39.       ReturnKey         = 269 ;   { keynumber of Return (= Enter) key }
  40.       EscapeKey         = 283 ;   { keynumber of Escape key }
  41.       LF                = #10 ;   { line feed character (ASCII value 10) }
  42.       FF                = #12 ;   { form feed character (ASCII value 12) }
  43.       CR                = #13 ;   { carriage return character (ASCII value 13) }
  44.       EF                = #26 ;   { end-of-file character (ASCII value 26) }
  45.       ConfigFilename    = 'AE.CFG' ; { name of file containing setup settings }
  46.       Find              = 1 ;     { used to indicate search type }
  47.       FindAndReplace    = 2 ;     { used to indicate search type }
  48.       MaxFileListLength = 100 ;   { maximum number of files that can be in }
  49.                                   { a file list }
  50.  
  51.  
  52. type Position       = record Index       : word ;
  53.                              Linenr      : word ;
  54.                              Colnr       : word ;
  55.                              end ;
  56.                       { a position within a workspace buffer is stored in two }
  57.                       { ways: an index for the array (of type WsBuftype) and }
  58.                       { a line number plus column number }
  59.      WsBuftype      = array [1..WsBufSize] of char ;
  60.      WsBufPtr       = ^WsBuftype ;
  61.      Workspacetype  = record Name            : PathStr ;
  62.                              ChangesMade     : boolean ;
  63.                              LastTimeSaved   : array [1..4] of word ;
  64.                                                { hrs,mins,secs,1/100 secs }
  65.                              CurPos          : Position ;
  66.                                                { current position }
  67.                              Mark            : word ;
  68.                                                { index of block mark }
  69.                              FirstVisiblePos : Position ;
  70.                              FirstScreenCol  : word ;
  71.                              VirtualColnr    : word ;
  72.                                                { column nr that CurPos should }
  73.                                                { be on when moving through    }
  74.                                                { buffer vertivally            }
  75.                              Buffer          : WsBufPtr ;
  76.                              BufferSize      : word ;
  77.                                                { number of chars in buffer }
  78.                              PosStack        : array [1..PosStackDepth] of word;
  79.                                                { position stack }
  80.                              PosStackPointer : byte ;
  81.                              end ;
  82.      PasteBuftype   = array [1..PasteBufSize] of char ;
  83.      SetupBlock     = record CursorType      : byte ;
  84.                              Keyclick        : boolean ;
  85.                              ScreenColors    : byte ;
  86.                              SoundBell       : boolean ;
  87.                              PageLength      : word ;
  88.                              LeftMargin      : word ;
  89.                              TopMargin       : word ;
  90.                              PrintPageNrs    : boolean ;
  91.                              WordWrapLength  : word ;
  92.                              TabSpacing      : word ;
  93.                              AutoIndent      : boolean ;
  94.                              DotsForSpaces   : boolean ;
  95.                              InsertMode      : boolean ;
  96.                              SaveOnExit      : boolean ;
  97.                              SaveInterval    : word ;
  98.                              MakeBAKfile     : boolean ;
  99.                              end ;
  100.      MacroBlock        = record Contents      : array [1..NrOfMacros,
  101.                                                        1..MaxMacroLength]
  102.                                                        of word ;
  103.                                 Length        : array [1..NrOfMacros] of word ;
  104.                                 end ;
  105.      ConfigBlock       = record Setup : SetupBlock ;
  106.                                 Macro : MacroBlock ;
  107.                                 end ;
  108.      MacroStackElement = record Macronr : byte ;
  109.                                 Index   : byte ;
  110.                                 end ;
  111.      { the following types are defined because most information is written }
  112.      { directly into video memory }
  113.      ScreenArray    = array[1..LinesOnScreen,1..ColsOnScreen] of word ;
  114.      ScreenPtr      = ^ScreenArray ;
  115.      ScreenBlock    = array[1..CharsOnScreen] of word ;
  116.      ScreenBlockPtr = ^ScreenBlock ;
  117.      ScreenElement  = record Contents  : char ;
  118.                              Attribute : byte ;
  119.                              end ;
  120.      ColorSetting   = record NormAttr   : byte ;
  121.                              BlockAttr  : byte ;
  122.                              StatusAttr : byte ;
  123.                              CursorAttr : byte ;
  124.                              end ;
  125.                       { contains the attributes used on the screen: NormAttr }
  126.                       { for normal characters, BlockAttr for characters      }
  127.                       { within the selected block, StatusAttr for characters }
  128.                       { on the status line and in messages                   }
  129.      FilenameStr    = string[12] ;
  130.                       { contains the name of a file plus extension }
  131.  
  132.  
  133. const DefaultSetup : { default setup, used if no setup file is found }
  134.                      { in the current directory }
  135.                      SetupBlock = (
  136.                             CursorType      : UnderLineCursor ;
  137.                             Keyclick        : False ;
  138.                             ScreenColors    : 3 ;
  139.                             SoundBell       : True ;
  140.                             PageLength      : Inactive ;
  141.                             LeftMargin      : 0 ;
  142.                             TopMargin       : 0 ;
  143.                             PrintPageNrs    : False ;
  144.                             WordWrapLength  : Inactive ;
  145.                             TabSpacing      : 0 ;
  146.                             AutoIndent      : True ;
  147.                             DotsForSpaces   : False ;
  148.                             InsertMode      : True ;
  149.                             SaveOnExit      : False ;
  150.                             SaveInterval    : Inactive ;
  151.                             MakeBAKfile     : False ) ;
  152.       ScreenColorArray : { contains the screen color settings that can be }
  153.                          { chosen from. Only the first two are available }
  154.                          { for monochrome video adapters }
  155.                          array [1..NrOfColorSettings] of ColorSetting =
  156.                            {1} ((NormAttr : $07 ;     { LightGrey/Black }
  157.                                  BlockAttr : $70 ;    { Black/LightGrey }
  158.                                  StatusAttr : $0F ;   { White/Black }
  159.                                  CursorAttr : $70) ,  { Black/LightGrey }
  160.                            {2}  (NormAttr : $07 ;     { LightGrey/Black }
  161.                                  BlockAttr : $70 ;    { Black/LightGrey }
  162.                                  StatusAttr : $70 ;   { Black/LightGrey }
  163.                                  CursorAttr : $70) ,  { Black/LightGrey }
  164.                            {3}  (NormAttr : $17 ;     { LightGrey/Blue }
  165.                                  BlockAttr : $3F ;    { White/Cyan }
  166.                                  StatusAttr : $71 ;   { Blue/LightGrey }
  167.                                  CursorAttr : $5F) ,  { White/Magenta }
  168.                            {4}  (NormAttr : $17 ;     { LightGrey/Blue }
  169.                                  BlockAttr : $5F ;    { White/Magenta }
  170.                                  StatusAttr : $7E ;   { Yellow/LightGrey }
  171.                                  CursorAttr : $3F) ,  { White/Cyan }
  172.                            {5}  (NormAttr : $70 ;     { Black/LightGrey }
  173.                                  BlockAttr : $17 ;    { LightGrey/Blue }
  174.                                  StatusAttr : $4F ;   { White/Red }
  175.                                  CursorAttr : $07) ,  { LightGrey/Black }
  176.                            {6}  (NormAttr : $07 ;     { LightGrey/Black }
  177.                                  BlockAttr : $70 ;    { Black/LightGrey }
  178.                                  StatusAttr : $74 ;   { Red/LightGrey }
  179.                                  CursorAttr : $47) ,  { LightGrey/Red }
  180.                            {7}  (NormAttr : $02 ;     { Green/Black }
  181.                                  BlockAttr : $70 ;    { Black/LightGrey }
  182.                                  StatusAttr : $7F ;   { White/LightGrey }
  183.                                  CursorAttr : $20) ,  { Black/Green }
  184.                            {8}  (NormAttr : $03 ;     { Cyan/Black }
  185.                                  BlockAttr : $17 ;    { LightGrey/Blue }
  186.                                  StatusAttr : $74 ;   { Red/LightGrey }
  187.                                  CursorAttr : $30)) ; { Black/Cyan }
  188.       { frame constant used as border string in calls of PutFrame }
  189.       Quasi3DFrame : string[8] = '┌─╖║╝═╘│' ;
  190.       { definition of characters that can act as word separators }
  191.       WordSeparators : set of char = [' ',',','.',':',';',CR,LF] ;
  192.       { constants used for constructing the statusline }
  193.       Status_Wrap   : string[4] = 'Wrap' ;   { indicates word wrap }
  194.       Status_Ins    : string[3] = 'Ins' ;    { indicates insert mode }
  195.       Status_Def    : string[3] = 'Def' ;    { on when defining a macro }
  196.       Status_Indent : string[6] = 'Indent' ; { indicates autoindent }
  197.       { basis for constructing the statusline }
  198.       BasicStatusLine : string [80] =
  199.                          '   L       C                            ' +
  200.                          '                     Ovr               %' ;
  201.       { string used to display CR/LF pair when entering search string }
  202.       CRLFalias : string[2] = #17 + #217 ;
  203.  
  204. var Config             : ConfigBlock ;
  205.     Workspace          : array [1..MaxNrOfWorkspaces] of Workspacetype ;
  206.     NrOfWorkspaces     : byte ;
  207.                          { actual number of workspaces. may be less than }
  208.                          { MaxNrOfWorkspaces if not enough memory }
  209.     CurrentWsnr        : byte ;
  210.                          { contains number of the current workspace }
  211.     PasteBuffer        : ^PasteBuftype ;
  212.     PasteBufferSize    : word ;
  213.                          { contains number of characters in paste buffer }
  214.     MacroStack         : array [1..MacroStackDepth] of MacroStackElement ;
  215.                          { macro stack is necessary because macros can call }
  216.                          { other macros }
  217.     MacroStackPointer  : byte ;
  218.     MacroDefining      : byte ;
  219.                          { number of the macro that is currently being }
  220.                          { defined (when 0: not defining any) }
  221.     FindString         : string ;
  222.     ReplaceString      : string ;
  223.     SearchOptions      : string[4] ;
  224.     SearchType         : byte ;
  225.     ColorCard          : boolean ;
  226.                          { indicates whether video adapter is monochrome }
  227.                          { or color }
  228.     OldCursorPosAttr   : byte ;
  229.                          { stores the original attribute for the screen }
  230.                          { location where the cursor is on.             }
  231.                          { (only for NoBlinkCursor)                     }
  232.     OrigCursorType     : byte ;
  233.     OrigTextAttr       : byte ;
  234.                          { cursor type and video text attribute on startup }
  235.                          { are kept for restoration on exiting program }
  236.     KeyNumber          : word ;
  237.     MessageRead        : boolean ;
  238.                          { indicates if the message on the status line has }
  239.                          { been read by the user }
  240.                          { set by Message, reset by GetKeyNr }
  241.     LoadfileName       : PathStr ;
  242.                          { contains name of last file to be read or inserted }
  243.     EscPressed         : boolean ;
  244.                          { indicates whether last call of EnterString, }
  245.                          { EnterWord, EnterBoolean, Answer or Choose was }
  246.                          { terminated by user by pressing Escape }
  247.     Found              : boolean ;
  248.                          { indicates whether last search operation or }
  249.                          { bracket matching was succesful }
  250.     IgnoreCase         : boolean ;
  251.     ReverseSearch      : boolean ;
  252.     NoQuery            : boolean ;
  253.     DiskError          : byte ;
  254.                          { contains result of last disk or print operation }
  255.                          { value 0: everything OK }
  256.     DisplayPtr         : ScreenPtr ;
  257.                          { points to begin of video memory }
  258.     {$IFDEF DEVELOP }
  259.     MinMemAvail        : longint ;
  260.                          { used to compute minimum heap size needed }
  261.     {$ENDIF }
  262.  
  263. implementation
  264.  
  265. begin
  266. end.
  267.